package com;

import com.model.User2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * User2在扫描范围内且已被注册为bean，可以直接硬注入
 * 对比类：com.EnableUserNotScanController
 */
@RestController
public class EnableUser2ScanController {
    @Autowired
    private User2 user2;

    @RequestMapping("user2")
    public int user2() {
        return this.user2.getAge();
    }
}
